//加载用户信息
let userInfo=sessionStorage.getItem("shop.userInfo");
let userLink=`<a class="nav-link" href="login.html">登录</a>`;
if(userInfo){
    let user=JSON.parse(userInfo);
    userLink=`<a class="nav-link" href="#">${user.nickname}</a>`;

}

let navContext=`<!-- 页面导航-->
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
    <div class="container-fluid">
        <a class="navbar-brand" href="#">Navbar w/ text</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarText">
            <ul class="navbar-nav me-auto mb-2 mb-lg-0">
                <li class="nav-item">
                    <a class="nav-link active" aria-current="page" href="#">Home</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="#">Features</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="#">Pricing</a>
                </li>
            </ul>
            <span class="navbar-text">
               ${userLink}
             </span>
        </div>
    </div>
</nav>
<!-- \\页面导航-->`;

let navDiv=document.querySelector("#navDiv");
navDiv.innerHTML=navContext;